package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.YxxDormitoryBalancesMapper;
import com.ruoyi.system.domain.YxxDormitoryBalances;
import com.ruoyi.system.service.IYxxDormitoryBalancesService;

/**
 * 寝室余额，记录水费和电费的可用余额Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-10
 */
@Service
public class YxxDormitoryBalancesServiceImpl implements IYxxDormitoryBalancesService 
{
    @Autowired
    private YxxDormitoryBalancesMapper yxxDormitoryBalancesMapper;

    /**
     * 查询寝室余额，记录水费和电费的可用余额
     * 
     * @param id 寝室余额，记录水费和电费的可用余额主键
     * @return 寝室余额，记录水费和电费的可用余额
     */
    @Override
    public YxxDormitoryBalances selectYxxDormitoryBalancesById(Long id)
    {
        return yxxDormitoryBalancesMapper.selectYxxDormitoryBalancesById(id);
    }

    /**
     * 查询寝室余额，记录水费和电费的可用余额列表
     * 
     * @param yxxDormitoryBalances 寝室余额，记录水费和电费的可用余额
     * @return 寝室余额，记录水费和电费的可用余额
     */
    @Override
    public List<YxxDormitoryBalances> selectYxxDormitoryBalancesList(YxxDormitoryBalances yxxDormitoryBalances)
    {
        return yxxDormitoryBalancesMapper.selectYxxDormitoryBalancesList(yxxDormitoryBalances);
    }

    /**
     * 新增寝室余额，记录水费和电费的可用余额
     * 
     * @param yxxDormitoryBalances 寝室余额，记录水费和电费的可用余额
     * @return 结果
     */
    @Override
    public int insertYxxDormitoryBalances(YxxDormitoryBalances yxxDormitoryBalances)
    {
        yxxDormitoryBalances.setCreateTime(DateUtils.getNowDate());
        return yxxDormitoryBalancesMapper.insertYxxDormitoryBalances(yxxDormitoryBalances);
    }

    /**
     * 修改寝室余额，记录水费和电费的可用余额
     * 
     * @param yxxDormitoryBalances 寝室余额，记录水费和电费的可用余额
     * @return 结果
     */
    @Override
    public int updateYxxDormitoryBalances(YxxDormitoryBalances yxxDormitoryBalances)
    {
        yxxDormitoryBalances.setUpdateTime(DateUtils.getNowDate());
        return yxxDormitoryBalancesMapper.updateYxxDormitoryBalances(yxxDormitoryBalances);
    }

    /**
     * 批量删除寝室余额，记录水费和电费的可用余额
     * 
     * @param ids 需要删除的寝室余额，记录水费和电费的可用余额主键
     * @return 结果
     */
    @Override
    public int deleteYxxDormitoryBalancesByIds(Long[] ids)
    {
        return yxxDormitoryBalancesMapper.deleteYxxDormitoryBalancesByIds(ids);
    }

    /**
     * 删除寝室余额，记录水费和电费的可用余额信息
     * 
     * @param id 寝室余额，记录水费和电费的可用余额主键
     * @return 结果
     */
    @Override
    public int deleteYxxDormitoryBalancesById(Long id)
    {
        return yxxDormitoryBalancesMapper.deleteYxxDormitoryBalancesById(id);
    }
}
